Skip to content

feat: agentx#348

Merged
adibarra merged 40 commits into
masterfrom
feat/agentx
Jul 3, 2026
Merged

feat: agentx#348
adibarra merged 40 commits into
masterfrom
feat/agentx

Conversation

@cquil11

@cquil11 cquil11 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Adds agentic trace-replay benchmarks (AgentX) to the dashboard: closed-loop replays of real multi-turn agent conversations (with subagent fan-out), alongside the existing fixed-seq-len sweeps. History is squashed into the logical commit groups below.

Database schema (feat(db): agentic benchmark schema)

New migrations (007_agentic.sql009_dataset_request_stats.sql):

  • benchmark_results extended for agentic rows
    • benchmark_type = 'agentic_traces'; isl/osl nullable (traces have no fixed sequence length)
    • offload_mode column added to the unique key (nulls not distinct) — the same config can run with KV offload on/off
    • trace_replay_id FK into the new sidecar table
    • metrics JSONB gains trace-derived keys: full latency percentile ladders (mean/median/p75/p90/p95/p99/p99.9 × ttft/tpot/itl/e2el), *_intvty (interactivity = 1/ITL), per-GPU throughputs, gpu_kv_cache_usage_pct, server/theoretical cache-hit rates, token totals
  • agentic_trace_replay — one row per benchmark point, keeps 100 MB+ payloads out of the hot query path
    • raw blobs: profile_export_jsonl_gz (every request the load generator sent) and server_metrics_json_gz (vLLM/SGLang Prometheus scrape summary)
    • precomputed, version-stamped JSONBs derived from those blobs at ingest time (see “time-series data” below): chart_series, request_timeline, aggregate_stats
  • datasets / dataset_conversations — the source trace datasets (HF id, slug, variant) and per-conversation structure: turn/subagent tree, token counts, timing, cache-hit distributions
  • run_datasets — links each workflow run to the dataset it replayed, so timeline → dataset deep links resolve
  • latest_benchmarks materialized view updated to include agentic rows (one run per line)

Time-series & per-request data ingested per run

  • chart_series (1 Hz server-side time series, one point per second of the run): KV-cache utilization (aggregate, per-DP-rank/engine, and host/CPU-offload for hicache), prefix-cache hit rate and hit-rate tokens/sec, queue depth (running/waiting), prefill and decode tokens/sec, prompt tokens by source — plus the same series grouped by server source for disagg runs
  • request_timeline (one record per HTTP request, ns-resolution): conversation id + turn index, worker id, subagent depth, warmup/profiling phase, credit-issued/start/ack/end timestamps, TTFT/TPOT, ISL/OSL, cancellation flag, and raw-source provenance (srcTrace/srcOuter/srcInner/srcKind) mapping every replayed request back to the exact original dataset request
  • aggregate_stats — percentile envelopes precomputed across sibling configs so the cross-config aggregate views don’t re-stream blobs
  • Payloads are versioned (CHART_SERIES_VERSION, REQUEST_TIMELINE_VERSION, STATS_VERSION): version-mismatched rows recompute from the raw blob on demand, and db:backfill-* CLIs re-materialize in bulk after an algorithm change
  • Per run this also ingests: server logs per point, availability rows, changelog entries, and the run→dataset link

Remaining commit groups

  • chore: deps/toolchain — stream-json (streaming 100 MB+ blobs without ERR_STRING_TOO_LONG), adm-zip, audit overrides
  • feat(db): ETL — maps aiperf artifacts across all three agg-schema generations (v3: nested request/server metrics, pre-inverted interactivity, cluster:-scoped hw ids, results/server.log); computes the three JSONB payloads at ingest
  • feat(db): query layer + CLIs — fast-path queries over precomputed JSONBs with version-checked blob fallback (guarding Neon’s 64 MiB response cap), shared backfill runner behind the four db:backfill-* scripts, ingest-weka-dataset for loading source datasets
  • ci: ingest workflowrepository_dispatch: ingest-agentic-results so the main InferenceX repo triggers ingestion after an AgentX sweep (mirrors the fixed-seq-len flow; 60-min timeout for blob uploads; Slack alert when a run references a dataset missing from datasets)
  • feat(api): endpoints + hooks — bulk-id v1 routes (aggregates, derived metrics, request timelines, server metrics, histograms, siblings, datasets) with shared route/hook factories for a uniform error contract and caching; matching React Query hooks
  • feat(datasets): dataset browser — dataset list/detail with token & cache-hit distributions; per-conversation flamegraph showing the turn/subagent timing tree; accepts ?turn/raw/inner/sa deep-link params to highlight the exact request
  • feat(agentic): per-point detail — summary cards; Gantt request timeline (per-conversation or per-worker rows, subagent/aux lane nesting, stable row colors across phase toggle, shift+scroll zoom, click-through to the original dataset request); rolling/cumulative time-series charts (interactivity, TTFT/E2E, KV usage, throughput, in-flight ISL/OSL); cross-config aggregates. Exists to debug why identical configs diverge under sustained load
  • feat(inference): dashboard integration — Agentic Traces as a scenario in the main chart: trace-derived x-axis modes, agentic-aware rooflines/tooltips/labels, click-through to point detail; works for official runs and ?unofficialrun= overlays
  • test: coverage + docs — Cypress e2e/component specs for timeline, time-series, datasets, and dashboard integration; data-pipeline docs

Diff breakdown

Category Added Removed
Code (app + db + constants) +15,815 −764
Tests (vitest + Cypress) +5,129 −133
CI / agent docs +376 −0
Docs +12 −0
Lockfile +36 −0

~24% of the diff is test coverage.

Verification

  • Typecheck, oxlint, oxfmt, 2,727 unit tests, production build, Cypress component (163) and targeted e2e — all pass
  • ETL recompute verified byte-identical against stored payloads for three trace replays (no backfill required)
  • Known pre-existing e2e failures (not introduced by this PR, tracked for follow-up):
    • url-params.cy.ts (2): Historical Trends tab defaults to Agentic Traces, which has no trend data, so the legend/high-contrast toggle never renders
    • agentic-point-time-series.cy.ts (3): stale point-count/label expectations from earlier chart changes

Note

High Risk
Large surface area (~21k LOC) touching DB ingest, new APIs with blob caching, and core global filter/scenario resolution; incorrect gating or cache versioning could mislabel charts or serve stale agentic payloads in production.

Overview
This PR ships AgentX end-to-end: agentic trace-replay benchmarks on the main inference chart, deep per-point views, a dataset browser, v1 APIs over precomputed trace blobs, and CI/operator docs for ingesting blob-heavy runs.

Inference dashboard renames the sequence control to scenario (scenario-selector, i_seq unchanged) and adds Agentic Traces as a first-class scenario with new x-axis modes (interactivity, TTFT, E2E, normalized E2E), percentile selection, legend points table drill-down to /inference/agentic/[id], and GPU tooltip View charts links. Global filters gain sequenceResolved so benchmarks and labels wait for real availability (no agentic flash/fetch for fixed-seq-only models). Agentic UI is behind a localStorage feature gate (AgenticGate, Cypress unlockAgenticGate); line labels default off; URL tests cover i_hc=0 and default toggle states.

New product surfaces: /datasets registry with distributions and searchable conversations; per-conversation flamegraphs (timing, parallel subagent brackets) with deep links from the request timeline; /inference/agentic/[id] detail (gated, positive id only). API layer adds shared id-routes factories, dataset CRUD/list routes (search length cap, single-decode convId contract), and version-derived blob cache keys for aggregates, timelines, histograms, and server metrics.

Pipeline & ops: ingest-agentic-results workflow (60m timeout, multi DB target, Slack on unmapped entities/missing datasets); .claude/agents/ingest.md runbook; docs/data-pipeline.md notes orchestrator metric adapters and run_datasets provenance from metadata.dataset. Unofficial-run overlays now carry benchmark_type / offload_mode and synthetic id: 0 so trace-backed features stay disabled for overlays as intended.

Reviewed by Cursor Bugbot for commit c9c8074. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented May 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inferencemax-app Ready Ready Preview, Comment Jul 3, 2026 9:07am

Request Review

Comment thread .github/workflows/ingest-agentic-results.yml Fixed
Comment thread packages/app/src/app/api/unofficial-run/route.ts
Comment thread packages/app/src/components/datasets/dataset-detail.tsx
Comment thread packages/app/src/lib/benchmark-transform.ts Outdated
Comment thread .github/workflows/ingest-agentic-results.yml
cquil11 added 2 commits July 2, 2026 18:47
…ions

The head commit message usually describes an unrelated code change;
the workflow display name describes the sweep itself.
Comment thread packages/app/src/components/inference/utils/legend-points-table.ts
cquil11 and others added 6 commits July 2, 2026 20:03
The failed-run guard required num_requests_total > 0, so a config whose
server never came up (total = 0, e.g. dep4 conc32 in run 28617267459)
slipped through as a dataless point. Any row explicitly reporting zero
successful requests is a failure regardless of how many were issued.
The documented DUMP_DIR mode 500'd on every new surface: the four new
tables (agentic_trace_replay, datasets, dataset_conversations,
run_datasets) were missing from TABLE_INSERT_ORDER so dumps never
carried them, json-provider had no mirrors, and ten routes called
getDb() with no JSON_MODE guard.

Tables added in FK-safe order; bytea blobs round-trip through dump/load
(Buffer JSON encoding, ::bytea decode); agentic_trace_replay lazy-loads
like server_logs; mirrors reuse the same pure compute helpers as the
SQL paths for version-stale fallbacks; all ten routes gain the standard
JSON_MODE branch. Verified end-to-end: dump-mode server serves all ten
endpoints 200, byte-identical to Postgres on 9/10 (remaining diffs are
pre-existing benchmarks-mirror nuances). Adds 21 mirror tests.
The AgenticTraces default resolved before availability loaded (static
SEQUENCE_OPTIONS fallback), so fixed-seq-only models flashed 'Agentic
Traces', fired a wasted agentic fetch, then snapped to 1k/1k. New pure
resolveEffectiveSequence helper (mirrors default-precisions pattern)
returns the real scenario only once availability is known; benchmark
fetching gates on the new sequenceResolved flag; non-agentic models
fall back to 8k/1k (master's default) when available.

Fixes the url-params and historical-trends e2e failures the PR
description labels 'pre-existing' — they were caused by this default
and now pass with no assertion changes. ttft-x-axis-toggle gets
spec-scoped agentic intercepts (shared fixtures have no agentic rows).
Verified live: llama70b -> 8K/1K, zero agentic calls, one benchmarks
fetch; dsr1 -> Agentic Traces, one fetch.
The public conversation search embedded user input in ILIKE unescaped
and uncapped: '%' matched every row and long stacked-wildcard patterns
could push Neon to statement timeout (500s). escapeLikePattern escapes
backslash-first then %/_ so searches are literal substring matches
(now agreeing exactly with the dump-mode mirror's .includes semantics);
the route trims and rejects >100 chars with 400 before touching the DB.
Live: ?search=%25 30 -> 0 rows; 150-char input -> 400; real searches
unchanged. Adds 14 tests.
…overlay-mode e2e

Adds the AGENTS.md-required track() calls (agentic_siblings_navigated,
datasets_conversations_page_changed, agentic_chart_expanded) to the
three untracked interaction clusters, and the mandated overlay-path
regression coverage: ttft-x-axis-toggle gains three tests loading an
?unofficialrun= overlay, switching to the ttft x-axis mode (overlay
points still render), and asserting the normalized-e2e suppression
banner. Cypress 8/8.
Playwright MCP page snapshots contain HTML-entity-escaped class strings;
Tailwind 4's auto content detection (which respects gitignore) scanned
them and emitted unresolvable mask-image classes, 500ing the dev server.
Affects any Playwright-MCP-driven review session incl. the @claude CI
review flow.
Comment thread packages/app/src/components/GlobalFilterContext.tsx Fixed
Comment thread packages/app/src/app/datasets/[slug]/conversations/[convId]/page.tsx Outdated
adibarra added 3 commits July 2, 2026 23:32
Agentic ships dark for now: the existing feature-gate mechanism (the
same localStorage flag behind the hidden-tabs pattern) now also gates
every AgentX surface, default off.

One deep chokepoint does most of the work: availableSequences strips
agentic-traces when locked, which cascades through the sequence
resolver - no agentic default, no scenario entry, no agentic x-axis
modes/percentile UI, no agentic tooltips (all downstream of
effectiveSequence). The Datasets nav link hides, and the standalone
/datasets/* and /inference/agentic/[id] pages notFound() when locked
(they have no nav entry and are robots-noindexed). Sitemap/llms.txt
already exclude them. API routes and ingest are not gated.

Agentic cypress specs seed the gate via unlockAgenticGate(). Verified
both states live: locked = 8k/1k default with zero agentic DOM + 404s;
unlocked = everything restored.
agentic-point-time-series: the point-count assertions predated the
time-boundary phase slicing — sliceTimelineByPhase puts every request
with start >= the profiling boundary in the profiling window, so the
warmup-labeled r5 legitimately lands there and cancelled/null-metric
filtering yields 6 interactivity/TTFT points and 8 E2E points (traced
to phase-slice.ts + time-series-math.ts, not just observed). No product
regression.

gpu-compare-agentic-detail: shared fixtures carry no agentic rows, so
the flow could never render; spec-scoped intercepts (availability,
benchmarks, trace-availability) now exercise the tooltip -> View charts
link without touching shared fixtures.

Full e2e suite: 449/449. These specs were failing all four CI shards on
every push of this branch.
adibarra added 2 commits July 3, 2026 01:06
…guards, conv-id encoding, stale intvty, phase filter)

- Chart-layer offload dedup: useChartData's latest-date-per-group key
  and mergeRunScopedRows' claim key now include offload_mode (?? 'off'),
  completing the SQL-layer fix - a later-dated offload sweep no longer
  drops the other variant's series or claims its base rows.
- PARAM_DEFAULTS.i_seq '' so an explicit 8K/1K pick survives share
  URLs instead of stripping and reloading as the agentic default; moved
  PRE_AVAILABILITY_SEQUENCE below imports (code-quality flag).
- Shared isPersistedBenchmarkId guard (integer > 0) at every agentic
  link/id-collection site: no /agentic/NaN or /agentic/0 links,
  overlay-only views skip the derived-metrics fetch instead of 400ing,
  and agentic/[id] notFound()s on invalid ids.
- Conversation ids: encode once at link producers, decode exactly once
  (removed double decodeURIComponent in page + route); ids with % / # ?
  now round-trip.
- ETL: missing/zero/invalid ITL now deletes the artifact-provided
  *_intvty key instead of passing p(1/ITL) values through; same fix on
  the documented overlay-path mirror in benchmark-transform.
- Gantt timeline now phase-slices by time boundary like the per-point
  charts (sliceTimelineByPhase), so both tabs agree on request sets;
  spec expectation updated with producing-logic justification.
- gitignore **/.next-* (secondary dist dirs from multi-server testing).

app 2381 + db 399 unit tests, full e2e 449/449.
The mode row (TTFT / E2E Latency / Normalized E2E / Interactivity /
Session Time / Prefill TPS) was hand-rolled chunky pills, visually
disconnected from every other control. It now reuses SegmentedToggle -
the repo's actual tab idiom (10+ call sites incl. the adjacent View
Mode toggle) - sized up via buttonClassName since this is a primary
control. Testids, track() events, tablist/tab aria semantics, and
agentic-only visibility unchanged; net -12 lines. Cypress
ttft-x-axis-toggle 8/8.
Comment thread packages/app/src/components/GlobalFilterContext.tsx
adibarra added 3 commits July 3, 2026 01:59
Replaces the SegmentedToggle pills with an accent-underline tab strip
(revived the unused Radix-backed ui/tabs.tsx primitive). Active tab
gets the repo's established nav-tab underline token (border-secondary
in light, dark:border-primary), plus a bg-muted/60 active fill so the
minecraft theme — whose global 'button { border: 2px !important }'
override suppresses the underline — still distinguishes the active tab.
Testids, track() events, agentic-only visibility, and Radix a11y
(role=tab/aria-selected/keyboard) all preserved; SegmentedToggle stays
for the adjacent view-mode toggle. cypress 8/8, vitest 2381/2381.
Drop the card-fill + white active text; adopt tab-nav.tsx's flat
underline-strip recipe verbatim — active = accent text
(text-secondary dark:text-primary) + matching border-b-2 underline, no
background, inactive = muted-foreground with border-only hover. The
x-axis mode row now reads identically to the dashboard's top section
tabs. cypress 8/8, vitest 2381.
Reverts two of this PR's default-flips per product decision: high
contrast (i_hc) and parallelism/advanced labels (i_advlabel) now
default off. InferenceContext drops defaultHighContrast:true and flips
the advlabel init to === '1'; both write-backs now encode ON as '1' /
OFF as '' (matching i_linelabel), consistent with the unchanged
PARAM_DEFAULTS so bare links render both off and i_hc=1/i_advlabel=1
still enable them. Specs updated; 62/62 affected e2e green.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c9c8074. Configure here.

Comment thread packages/app/src/app/api/v1/trace-availability/route.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants